

import 'package:flutter/material.dart';

class  SimpleDialogView extends StatelessWidget {
  const  SimpleDialogView({super.key});


  _simpleDialog(BuildContext context) async {
    var result = await showDialog(
        barrierDismissible: true, //表示点击灰色背景的时候是否消失弹出框
        context: context,
        builder: (context) {
          return SimpleDialog(
            title: const Text("请选择内容"),
            children: <Widget>[


              Center(
                child: ClipOval(
                  child: Image.network(
                      "https://www.itying.com/themes/itying/images/ionic4.png",
                      width: 250.0,
                      height: 250.0,
                      fit: BoxFit.cover),
                ),
              ),



              SimpleDialogOption(
                child: const Text("Option A"),
                onPressed: () {
                  print("Option A");
                  Navigator.pop(context, "A");
                },
              ),
              const Divider(),
              SimpleDialogOption(
                child: const Text("Option B"),
                onPressed: () {
                  print("Option B");
                  Navigator.pop(context, "B");
                },
              ),
              const Divider(),
              SimpleDialogOption(
                child: const Text("Option C"),
                onPressed: () {
                  print("Option C");
                  Navigator.pop(context, "C");
                },
              ),
            ],
          );
        });
    print(result);
  }


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter SimpleDialog Example'),
      ),
      body: Center(
        child: ElevatedButton(
          onPressed: () {
            _simpleDialog(context);
          },
          child: Text('Show Alert'),
        ),
      ),
    );
  }
}
